/*
 *    Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.sample.prdownloader.slics;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.ProgressBar;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
import ohos.app.Context;
import ohos.app.Environment;
import ohos.bundle.AbilityInfo;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

import com.prdownloader.OnCancelListener;
import com.prdownloader.OnDownloadListener;
import com.prdownloader.OnPauseListener;
import com.prdownloader.OnProgressListener;
import com.prdownloader.OnStartOrResumeListener;
import com.prdownloader.PRDownloader;
import com.prdownloader.Progress;
import com.prdownloader.Status;


import com.sample.prdownloader.ResourceTable;
import com.sample.prdownloader.util.ToastsUtils;
import com.sample.prdownloader.util.Util;

import static ohos.bundle.AbilityInfo.DisplayOrientation.LANDSCAPE;

/**
 * 下载页面
 *
 * @since 2021-04-23
 */
public class MainAbilitySlice extends AbilitySlice {
    static final HiLogLabel HI_LOG_LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00101, "MainAbilitySlice");
    private String dirPath;
    final String mUrl1 = "https://imtt.dd.qq.com/16891/apk/02C5280412D35579561376A8226FD4FC.apk?fsname=com.tencent.qqgame.xq_40808.apk";
    final String mUrl2 = "https://9ae0c157b383c826c7e01d180674f266.dlied1.cdntips.net/imtt.dd.qq.com/16891/apk/5D88EFE1E85964D8768FE7AC117D4734.apk";
    final String mUrl3 = "https://2b68338fea016ed447a22e07befe108c.dlied1.cdntips.net/imtt.dd.qq.com/16891/apk/D141C7CA03123424862B28A8D0EDED68.apk";
    final String mUrl4 = "https://imtt.dd.qq.com/16891/apk/94B6A8DF422CA50EBCFA7181FCB67172.apk?fsname=com.tencent.androidqqmail_6.2.1_10149355.apk";
    final String mUrl5 = "https://imtt.dd.qq.com/16891/apk/FEC518DCA9695EB8B32B6724222D4F9A.apk";
    final String mUrl6 = "http://imtt.dd.qq.com/16891/apk/562C941E91F2AD39EA7422C391AF18C0.apk";
    final String mUrl7 = "https://microdown.myapp.com/ug/202107193_f1f42899f9f8396e0e6f12d3e2d6aa47_offset_10846208.apk";
    final String mUrl8 = "https://microdown.myapp.com/ug/202107193_40e3e2836097975bd3d4c10eee7c201d_offset_10846208.apk";
    final String mUrl9 = "https://imtt.dd.qq.com/16891/apk/0ED1E9016450D69D0BA2F65C1ECF5278.apk";
    final String mUrl10 = "https://imtt.dd.qq.com/16891/apk/049BDDB94002578629899B9411A02FBC.apk";
    final String mUrl11 = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v";
    final String mUrl12 = "https://www.0101ssd.com/uploads/outsite/sdzx-44800";
    final String mUrl13 = "https://www.0101ssd.com/uploads/outsite/sdzx-44920";
    final String mUrl14 = "http://techslides.com/demos/sample-videos/small.mp4";
    final String mUrl15 = "https://www.0101ssd.com/uploads/20210713/video/mp4/5326cb161c649ecf329c440985062d81.mp4";

    String darcklight = "#999999";
    String darckmid = "#666666";
    String darckdeep = "#333333";
    String mei = " ";

    Button buttonOne;
    Button buttonTwo;
    Button buttonThree;
    Button buttonFour;
    Button buttonFive;
    Button buttonSix;
    Button buttonSeven;
    Button buttonEight;
    Button buttonNine;
    Button buttonTen;
    Button buttonEleven;
    Button buttonTwelve;
    Button buttonThirteen;
    Button buttonFourteen;
    Button buttonFifteen;
    Button buttonCancelOne;
    Button buttonCancelTwo;
    Button buttonCancelThree;
    Button buttonCancelFour;
    Button buttonCancelFive;
    Button buttonCancelSix;
    Button buttonCancelSeven;
    Button buttonCancelEight;
    Button buttonCancelNine;
    Button buttonCancelTen;
    Button buttonCancelEleven;
    Button buttonCancelTwelve;
    Button buttonCancelThirteen;
    Button buttonCancelFourteen;
    Button buttonCancelFifteen;

    Text textViewProgressOne;
    Text textViewProgressTwo;
    Text textViewProgressThree;
    Text textViewProgressFour;
    Text textViewProgressFive;
    Text textViewProgressSix;
    Text textViewProgressSeven;
    Text textViewProgressEight;
    Text textViewProgressNine;
    Text textViewProgressTen;
    Text textViewProgressEleven;
    Text textViewProgressTwelve;
    Text textViewProgressThirteen;
    Text textViewProgressFourteen;
    Text textViewProgressFifteen;

    ProgressBar progressBarOne;
    ProgressBar progressBarTwo;
    ProgressBar progressBarThree;
    ProgressBar progressBarFour;
    ProgressBar progressBarFive;
    ProgressBar progressBarSix;
    ProgressBar progressBarSeven;
    ProgressBar progressBarEight;
    ProgressBar progressBarNine;
    ProgressBar progressBarTen;
    ProgressBar progressBarEleven;
    ProgressBar progressBarTwelve;
    ProgressBar progressBarThirteen;
    ProgressBar progressBarFourteen;
    ProgressBar progressBarFifteen;

    int downloadIdOne;
    int downloadIdTwo;
    int downloadIdThree;
    int downloadIdFour;
    int downloadIdFive;
    int downloadIdSix;
    int downloadIdSeven;
    int downloadIdEight;
    int downloadIdNine;
    int downloadIdTen;
    int downloadIdEleven;
    int downloadIdTwelve;
    int downloadIdThirteen;
    int downloadIdFourteen;
    int downloadIdFifteen;
    ShapeElement backgroundDark;
    ShapeElement backgroundLight;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        dirPath = getRootDirPath(this);
        backgroundDark = new ShapeElement();
        backgroundDark.setRgbColor(new RgbColor(153, 153, 153));
        backgroundDark.setStroke(2, new RgbColor(153, 153, 153));
        backgroundDark.setCornerRadius(5);
        backgroundLight = new ShapeElement();
        backgroundLight.setRgbColor(new RgbColor(204, 204, 204));
        backgroundLight.setStroke(2, new RgbColor(204, 204, 204));
        backgroundLight.setCornerRadius(5);
        getWindow().setStatusBarColor(Color.getIntColor("#303F9F"));
        initViewButton();
        initViewButtonCancel();
        initViewTextAndProgressBar();
        onClickListenerOne();
        onClickListenerTwo();
        onClickListenerThree();
        onClickListenerFour();
        onClickListenerFive();
        onClickListenerSix();
        onClickListenerSeven();
        onClickListenerEight();
        onClickListenerNine();
        onClickListenerTen();
        onClickListenerEleven();
        onClickListenerTwelve();
        onClickListenerThirteen();
        onClickListenerFourteen();
        onClickListenerFifteen();
    }

    private void initViewButton() {
        buttonOne = (Button) findComponentById(ResourceTable.Id_buttonOne);
        buttonTwo = (Button) findComponentById(ResourceTable.Id_buttonTwo);
        buttonThree = (Button) findComponentById(ResourceTable.Id_buttonThree);
        buttonFour = (Button) findComponentById(ResourceTable.Id_buttonFour);
        buttonFive = (Button) findComponentById(ResourceTable.Id_buttonFive);
        buttonSix = (Button) findComponentById(ResourceTable.Id_buttonSix);
        buttonSeven = (Button) findComponentById(ResourceTable.Id_buttonSeven);
        buttonEight = (Button) findComponentById(ResourceTable.Id_buttonEight);
        buttonNine = (Button) findComponentById(ResourceTable.Id_buttonNine);
        buttonTen = (Button) findComponentById(ResourceTable.Id_buttonTen);
        buttonEleven = (Button) findComponentById(ResourceTable.Id_buttonEleven);
        buttonTwelve = (Button) findComponentById(ResourceTable.Id_buttonTwelve);
        buttonThirteen = (Button) findComponentById(ResourceTable.Id_buttonThirteen);
        buttonFourteen = (Button) findComponentById(ResourceTable.Id_buttonFourteen);
        buttonFifteen = (Button) findComponentById(ResourceTable.Id_buttonFifteen);

        buttonOne.setBackground(backgroundLight);
        buttonTwo.setBackground(backgroundLight);
        buttonThree.setBackground(backgroundLight);
        buttonFour.setBackground(backgroundLight);
        buttonFive.setBackground(backgroundLight);
        buttonSix.setBackground(backgroundLight);
        buttonSeven.setBackground(backgroundLight);
        buttonEight.setBackground(backgroundLight);
        buttonNine.setBackground(backgroundLight);
        buttonTen.setBackground(backgroundLight);
        buttonEleven.setBackground(backgroundLight);
        buttonTwelve.setBackground(backgroundLight);
        buttonThirteen.setBackground(backgroundLight);
        buttonFourteen.setBackground(backgroundLight);
        buttonFifteen.setBackground(backgroundLight);
    }

    private void initViewButtonCancel() {
        buttonCancelOne = (Button) findComponentById(ResourceTable.Id_buttonCancelOne);
        buttonCancelTwo = (Button) findComponentById(ResourceTable.Id_buttonCancelTwo);
        buttonCancelThree = (Button) findComponentById(ResourceTable.Id_buttonCancelThree);
        buttonCancelFour = (Button) findComponentById(ResourceTable.Id_buttonCancelFour);
        buttonCancelFive = (Button) findComponentById(ResourceTable.Id_buttonCancelFive);
        buttonCancelSix = (Button) findComponentById(ResourceTable.Id_buttonCancelSix);
        buttonCancelSeven = (Button) findComponentById(ResourceTable.Id_buttonCancelSeven);
        buttonCancelEight = (Button) findComponentById(ResourceTable.Id_buttonCancelEight);
        buttonCancelNine = (Button) findComponentById(ResourceTable.Id_buttonCancelNine);
        buttonCancelTen = (Button) findComponentById(ResourceTable.Id_buttonCancelTen);
        buttonCancelEleven = (Button) findComponentById(ResourceTable.Id_buttonCancelEleven);
        buttonCancelTwelve = (Button) findComponentById(ResourceTable.Id_buttonCancelTwelve);
        buttonCancelThirteen = (Button) findComponentById(ResourceTable.Id_buttonCancelThirteen);
        buttonCancelFourteen = (Button) findComponentById(ResourceTable.Id_buttonCancelFourteen);
        buttonCancelFifteen = (Button) findComponentById(ResourceTable.Id_buttonCancelFifteen);
        buttonCancelOne.setBackground(backgroundLight);
        buttonCancelTwo.setBackground(backgroundLight);
        buttonCancelThree.setBackground(backgroundLight);
        buttonCancelFour.setBackground(backgroundLight);
        buttonCancelFive.setBackground(backgroundLight);
        buttonCancelSix.setBackground(backgroundLight);
        buttonCancelSeven.setBackground(backgroundLight);
        buttonCancelEight.setBackground(backgroundLight);
        buttonCancelNine.setBackground(backgroundLight);
        buttonCancelTen.setBackground(backgroundLight);
        buttonCancelEleven.setBackground(backgroundLight);
        buttonCancelTwelve.setBackground(backgroundLight);
        buttonCancelThirteen.setBackground(backgroundLight);
        buttonCancelFourteen.setBackground(backgroundLight);
        buttonCancelFifteen.setBackground(backgroundLight);
    }

    private void initViewTextAndProgressBar() {
        textViewProgressOne = (Text) findComponentById(ResourceTable.Id_textViewProgressOne);
        textViewProgressTwo = (Text) findComponentById(ResourceTable.Id_textViewProgressTwo);
        textViewProgressThree = (Text) findComponentById(ResourceTable.Id_textViewProgressThree);
        textViewProgressFour = (Text) findComponentById(ResourceTable.Id_textViewProgressFour);
        textViewProgressFive = (Text) findComponentById(ResourceTable.Id_textViewProgressFive);
        textViewProgressSix = (Text) findComponentById(ResourceTable.Id_textViewProgressSix);
        textViewProgressSeven = (Text) findComponentById(ResourceTable.Id_textViewProgressSeven);
        textViewProgressEight = (Text) findComponentById(ResourceTable.Id_textViewProgressEight);
        textViewProgressNine = (Text) findComponentById(ResourceTable.Id_textViewProgressNine);
        textViewProgressTen = (Text) findComponentById(ResourceTable.Id_textViewProgressTen);
        textViewProgressEleven = (Text) findComponentById(ResourceTable.Id_textViewProgressEleven);
        textViewProgressTwelve = (Text) findComponentById(ResourceTable.Id_textViewProgressTwelve);
        textViewProgressThirteen = (Text) findComponentById(ResourceTable.Id_textViewProgressThirteen);
        textViewProgressFourteen = (Text) findComponentById(ResourceTable.Id_textViewProgressFourteen);
        textViewProgressFifteen = (Text) findComponentById(ResourceTable.Id_textViewProgressFifteen);

        progressBarOne = (ProgressBar) findComponentById(ResourceTable.Id_progressBarOne);
        progressBarTwo = (ProgressBar) findComponentById(ResourceTable.Id_progressBarTwo);
        progressBarThree = (ProgressBar) findComponentById(ResourceTable.Id_progressBarThree);
        progressBarFour = (ProgressBar) findComponentById(ResourceTable.Id_progressBarFour);
        progressBarFive = (ProgressBar) findComponentById(ResourceTable.Id_progressBarFive);
        progressBarSix = (ProgressBar) findComponentById(ResourceTable.Id_progressBarSix);
        progressBarSeven = (ProgressBar) findComponentById(ResourceTable.Id_progressBarSeven);
        progressBarEight = (ProgressBar) findComponentById(ResourceTable.Id_progressBarEight);
        progressBarNine = (ProgressBar) findComponentById(ResourceTable.Id_progressBarNine);
        progressBarTen = (ProgressBar) findComponentById(ResourceTable.Id_progressBarTen);
        progressBarEleven = (ProgressBar) findComponentById(ResourceTable.Id_progressBarEleven);
        progressBarTwelve = (ProgressBar) findComponentById(ResourceTable.Id_progressBarTwelve);
        progressBarThirteen = (ProgressBar) findComponentById(ResourceTable.Id_progressBarThirteen);
        progressBarFourteen = (ProgressBar) findComponentById(ResourceTable.Id_progressBarFourteen);
        progressBarFifteen = (ProgressBar) findComponentById(ResourceTable.Id_progressBarFifteen);
    }

    /**
     * 第一排确认按钮监听
     */
    public void onClickListenerOne() {
        buttonOne.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdOne)) {
                    PRDownloader.pause(downloadIdOne);
                    return;
                }
                buttonOne.setEnabled(false);
                buttonOne.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarOne.setIndeterminate(true);
                if (Status.PAUSED == PRDownloader.getStatus(downloadIdOne)) {
                    PRDownloader.resume(downloadIdOne);
                    return;
                }

                downloadIdOne = PRDownloader.download(mUrl1, dirPath, "facebook.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarOne.setIndeterminate(false);
                            buttonOne.setEnabled(true);
                            buttonOne.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonOne.setText(ResourceTable.String_pause);
                            buttonCancelOne.setEnabled(true);
                            buttonCancelOne.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonOne.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            buttonOne.setText(ResourceTable.String_start);
                            buttonCancelOne.setEnabled(false);
                            buttonCancelOne.setTextColor(new Color(Color.getIntColor(darcklight)));
                            progressBarOne.setProgressValue(0);
                            textViewProgressOne.setText("");
                            downloadIdOne = 0;
                            progressBarOne.setIndeterminate(false);
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarOne.setProgressValue((int) progressPercent);
                            textViewProgressOne.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                            progressBarOne.setIndeterminate(false);
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonOne.setEnabled(false);
                            buttonOne.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelOne.setEnabled(false);
                            buttonCancelOne.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonOne.setText(ResourceTable.String_completed);
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonOne.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "1")
                                .build().show();

                            textViewProgressOne.setText("");
                            progressBarOne.setProgressValue(0);
                            downloadIdOne = 0;
                            buttonCancelOne.setEnabled(false);
                            progressBarOne.setIndeterminate(false);
                            buttonOne.setEnabled(true);
                            buttonOne.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelOne.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelOne.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdOne);
            }
        });
    }

    /**
     * 第二排确认按钮监听
     */
    public void onClickListenerTwo() {
        buttonTwo.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdTwo)) {
                    PRDownloader.pause(downloadIdTwo);
                    return;
                }

                buttonTwo.setEnabled(false);
                buttonTwo.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarTwo.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdTwo)) {
                    PRDownloader.resume(downloadIdTwo);
                    return;
                }
                downloadIdTwo = PRDownloader.download(mUrl2, dirPath, "wechat.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarTwo.setIndeterminate(false);
                            buttonTwo.setEnabled(true);
                            buttonTwo.setText(ResourceTable.String_pause);
                            buttonCancelTwo.setEnabled(true);
                            buttonCancelTwo.setText(ResourceTable.String_cancel);
                            buttonTwo.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTwo.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonTwo.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdTwo = 0;
                            buttonTwo.setText(ResourceTable.String_start);
                            buttonCancelTwo.setEnabled(false);
                            progressBarTwo.setProgressValue(0);
                            textViewProgressTwo.setText("");
                            progressBarTwo.setIndeterminate(false);
                            buttonCancelTwo.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {

                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarTwo.setProgressValue((int) progressPercent);
                            textViewProgressTwo.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonTwo.setEnabled(false);
                            buttonCancelTwo.setEnabled(false);
                            buttonTwo.setText(ResourceTable.String_completed);
                            buttonTwo.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelTwo.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonTwo.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "2")
                                .build().show();
                            textViewProgressTwo.setText("");
                            progressBarTwo.setProgressValue(0);
                            downloadIdTwo = 0;
                            buttonCancelTwo.setEnabled(false);
                            progressBarTwo.setIndeterminate(false);
                            buttonTwo.setEnabled(true);
                            buttonTwo.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTwo.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelTwo.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdTwo);
            }
        });
    }

    /**
     * 第三排确认按钮监听
     */
    public void onClickListenerThree() {
        buttonThree.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdThree)) {
                    PRDownloader.pause(downloadIdThree);
                    return;
                }

                buttonThree.setEnabled(false);
                progressBarThree.setIndeterminate(true);
                buttonThree.setTextColor(new Color(Color.getIntColor(darcklight)));

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdThree)) {
                    PRDownloader.resume(downloadIdThree);
                    return;
                }
                downloadIdThree = PRDownloader.download(mUrl3, dirPath, "instagram.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarThree.setIndeterminate(false);
                            buttonThree.setEnabled(true);
                            buttonThree.setText(ResourceTable.String_pause);
                            buttonCancelThree.setEnabled(true);
                            buttonCancelThree.setText(ResourceTable.String_cancel);
                            buttonThree.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelThree.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonThree.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdThree = 0;
                            buttonThree.setText(ResourceTable.String_start);
                            buttonCancelThree.setEnabled(false);
                            progressBarThree.setProgressValue(0);
                            textViewProgressThree.setText("");
                            progressBarThree.setIndeterminate(false);
                            buttonCancelThree.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarThree.setProgressValue((int) progressPercent);
                            textViewProgressThree.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonThree.setEnabled(false);
                            buttonCancelThree.setEnabled(false);
                            buttonThree.setText(ResourceTable.String_completed);
                            buttonThree.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelThree.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonThree.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "3")
                                .build().show();
                            textViewProgressThree.setText("");
                            progressBarThree.setProgressValue(0);
                            downloadIdThree = 0;
                            buttonCancelThree.setEnabled(false);
                            progressBarThree.setIndeterminate(false);
                            buttonThree.setEnabled(true);
                            buttonThree.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelThree.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelThree.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdThree);
            }
        });
    }

    /**
     * 第四排确认按钮监听
     */
    public void onClickListenerFour() {
        buttonFour.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdFour)) {
                    PRDownloader.pause(downloadIdFour);
                    return;
                }

                buttonFour.setEnabled(false);
                progressBarFour.setIndeterminate(true);
                buttonFour.setTextColor(new Color(Color.getIntColor(darcklight)));
                if (Status.PAUSED == PRDownloader.getStatus(downloadIdFour)) {
                    PRDownloader.resume(downloadIdFour);
                    return;
                }
                downloadIdFour = PRDownloader.download(mUrl4, dirPath, "flashlight.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarFour.setIndeterminate(false);
                            buttonFour.setEnabled(true);
                            buttonFour.setText(ResourceTable.String_pause);
                            buttonCancelFour.setEnabled(true);
                            buttonCancelFour.setText(ResourceTable.String_cancel);
                            buttonFour.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFour.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonFour.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdFour = 0;
                            buttonFour.setText(ResourceTable.String_start);
                            buttonCancelFour.setEnabled(false);
                            progressBarFour.setProgressValue(0);
                            textViewProgressFour.setText("");
                            progressBarFour.setIndeterminate(false);
                            buttonCancelFour.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarFour.setProgressValue((int) progressPercent);
                            textViewProgressFour.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonFour.setEnabled(false);
                            buttonCancelFour.setEnabled(false);
                            buttonFour.setText(ResourceTable.String_completed);
                            buttonFour.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelFour.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonFour.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "4")
                                .build().show();
                            textViewProgressFour.setText("");
                            progressBarFour.setProgressValue(0);
                            downloadIdFour = 0;
                            buttonCancelFour.setEnabled(false);
                            progressBarFour.setIndeterminate(false);
                            buttonFour.setEnabled(true);
                            buttonFour.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFour.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelFour.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdFour);
            }
        });
    }

    /**
     * 第五排确认按钮监听
     */
    public void onClickListenerFive() {
        buttonFive.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdFive)) {
                    PRDownloader.pause(downloadIdFive);
                    return;
                }

                buttonFive.setEnabled(false);
                progressBarFive.setIndeterminate(true);
                buttonFive.setTextColor(new Color(Color.getIntColor(darcklight)));

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdFive)) {
                    PRDownloader.resume(downloadIdFive);
                    return;
                }
                downloadIdFive = PRDownloader.download(mUrl5, dirPath, "screenrecorder.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarFive.setIndeterminate(false);
                            buttonFive.setEnabled(true);
                            buttonFive.setText(ResourceTable.String_pause);
                            buttonCancelFive.setEnabled(true);
                            buttonCancelFive.setText(ResourceTable.String_cancel);
                            buttonFive.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFive.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonFive.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdFive = 0;
                            buttonFive.setText(ResourceTable.String_start);
                            buttonCancelFive.setEnabled(false);
                            progressBarFive.setProgressValue(0);
                            textViewProgressFive.setText("");
                            progressBarFive.setIndeterminate(false);
                            buttonCancelFive.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarFive.setProgressValue((int) progressPercent);
                            textViewProgressFive.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));

                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonFive.setEnabled(false);
                            buttonCancelFive.setEnabled(false);
                            buttonFive.setText(ResourceTable.String_completed);
                            buttonFive.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelFive.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonFive.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "5")
                                .build().show();
                            textViewProgressFive.setText("");
                            progressBarFive.setProgressValue(0);
                            downloadIdFive = 0;
                            buttonCancelFive.setEnabled(false);
                            progressBarFive.setIndeterminate(false);
                            buttonFive.setEnabled(true);
                            buttonFive.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFive.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelFive.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdFive);
            }
        });
    }

    /**
     * 第六排确认按钮监听
     */
    public void onClickListenerSix() {
        buttonSix.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdSix)) {
                    PRDownloader.pause(downloadIdSix);
                    return;
                }

                buttonSix.setEnabled(false);
                progressBarSix.setIndeterminate(true);
                buttonSix.setTextColor(new Color(Color.getIntColor(darcklight)));

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdSix)) {
                    PRDownloader.resume(downloadIdSix);
                    return;
                }
                downloadIdSix = PRDownloader.download(mUrl6, dirPath, "callrecorder.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarSix.setIndeterminate(false);
                            buttonSix.setEnabled(true);
                            buttonSix.setText(ResourceTable.String_pause);
                            buttonCancelSix.setEnabled(true);
                            buttonCancelSix.setText(ResourceTable.String_cancel);
                            buttonSix.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelSix.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonSix.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdSix = 0;
                            buttonSix.setText(ResourceTable.String_start);
                            buttonCancelSix.setEnabled(false);
                            progressBarSix.setProgressValue(0);
                            textViewProgressSix.setText("");
                            progressBarSix.setIndeterminate(false);
                            buttonCancelSix.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarSix.setProgressValue((int) progressPercent);
                            textViewProgressSix.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonSix.setEnabled(false);
                            buttonCancelSix.setEnabled(false);
                            buttonSix.setText(ResourceTable.String_completed);
                            buttonSix.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelSix.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonSix.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "6")
                                .build().show();
                            textViewProgressSix.setText("");
                            progressBarSix.setProgressValue(0);
                            downloadIdSix = 0;
                            buttonCancelSix.setEnabled(false);
                            progressBarSix.setIndeterminate(false);
                            buttonSix.setEnabled(true);
                            buttonSix.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelSix.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelSix.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdSix);
            }
        });

    }

    /**
     * 第七排确认按钮监听
     */
    public void onClickListenerSeven() {
        buttonSeven.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdSeven)) {
                    PRDownloader.pause(downloadIdSeven);
                    return;
                }

                buttonSeven.setEnabled(false);
                progressBarSeven.setIndeterminate(true);
                buttonSeven.setTextColor(new Color(Color.getIntColor(darcklight)));

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdSeven)) {
                    PRDownloader.resume(downloadIdSeven);
                    return;
                }
                downloadIdSeven = PRDownloader.download(mUrl7, dirPath, "soundprofile.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarSeven.setIndeterminate(false);
                            buttonSeven.setEnabled(true);
                            buttonSeven.setText(ResourceTable.String_pause);
                            buttonCancelSeven.setEnabled(true);
                            buttonCancelSeven.setText(ResourceTable.String_cancel);
                            buttonSeven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelSeven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonSeven.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdSeven = 0;
                            buttonSeven.setText(ResourceTable.String_start);
                            buttonCancelSeven.setEnabled(false);
                            progressBarSeven.setProgressValue(0);
                            textViewProgressSeven.setText("");
                            progressBarSeven.setIndeterminate(false);
                            buttonCancelSeven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarSeven.setProgressValue((int) progressPercent);
                            textViewProgressSeven.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonSeven.setEnabled(false);
                            buttonCancelSeven.setEnabled(false);
                            buttonSeven.setText(ResourceTable.String_completed);
                            buttonSeven.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelSeven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonSeven.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "7")
                                .build().show();
                            textViewProgressSeven.setText("");
                            progressBarSeven.setProgressValue(0);
                            downloadIdSeven = 0;
                            buttonCancelSeven.setEnabled(false);
                            progressBarSeven.setIndeterminate(false);
                            buttonSeven.setEnabled(true);
                            buttonSeven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelSeven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelSeven.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdSeven);
            }
        });

    }

    /**
     * 第八排确认按钮监听
     */
    public void onClickListenerEight() {
        buttonEight.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdEight)) {
                    PRDownloader.pause(downloadIdEight);
                    return;
                }

                buttonEight.setEnabled(false);
                buttonEight.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarEight.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdEight)) {
                    PRDownloader.resume(downloadIdEight);
                    return;
                }
                downloadIdEight = PRDownloader.download(mUrl8, dirPath, "evernote.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarEight.setIndeterminate(false);
                            buttonEight.setEnabled(true);
                            buttonEight.setText(ResourceTable.String_pause);
                            buttonCancelEight.setEnabled(true);
                            buttonCancelEight.setText(ResourceTable.String_cancel);
                            buttonEight.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelEight.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonEight.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdEight = 0;
                            buttonEight.setText(ResourceTable.String_start);
                            buttonCancelEight.setEnabled(false);
                            progressBarEight.setProgressValue(0);
                            textViewProgressEight.setText("");
                            progressBarEight.setIndeterminate(false);
                            buttonCancelEight.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarEight.setProgressValue((int) progressPercent);
                            textViewProgressEight.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonEight.setEnabled(false);
                            buttonCancelEight.setEnabled(false);
                            buttonEight.setText(ResourceTable.String_completed);
                            buttonEight.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelEight.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonEight.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "8")
                                .build().show();
                            textViewProgressEight.setText("");
                            progressBarEight.setProgressValue(0);
                            downloadIdEight = 0;
                            buttonCancelEight.setEnabled(false);
                            progressBarEight.setIndeterminate(false);
                            buttonEight.setEnabled(true);
                            buttonEight.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelEight.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelEight.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdEight);
            }
        });
    }

    /**
     * 第九排确认按钮监听
     */
    public void onClickListenerNine() {
        buttonNine.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdNine)) {
                    PRDownloader.pause(downloadIdNine);
                    return;
                }

                buttonNine.setEnabled(false);
                buttonNine.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarNine.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdNine)) {
                    PRDownloader.resume(downloadIdNine);
                    return;
                }
                downloadIdNine = PRDownloader.download(mUrl9, dirPath, "ucbrowser.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarNine.setIndeterminate(false);
                            buttonNine.setEnabled(true);
                            buttonNine.setText(ResourceTable.String_pause);
                            buttonCancelNine.setEnabled(true);
                            buttonCancelNine.setText(ResourceTable.String_cancel);
                            buttonNine.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelNine.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonNine.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdNine = 0;
                            buttonNine.setText(ResourceTable.String_start);
                            buttonCancelNine.setEnabled(false);
                            progressBarNine.setProgressValue(0);
                            textViewProgressNine.setText("");
                            progressBarNine.setIndeterminate(false);
                            buttonCancelNine.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarNine.setProgressValue((int) progressPercent);
                            textViewProgressNine.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonNine.setEnabled(false);
                            buttonCancelNine.setEnabled(false);
                            buttonNine.setText(ResourceTable.String_completed);
                            buttonNine.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelNine.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonNine.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "9")
                                .build().show();
                            textViewProgressNine.setText("");
                            progressBarNine.setProgressValue(0);
                            downloadIdNine = 0;
                            buttonCancelNine.setEnabled(false);
                            progressBarNine.setIndeterminate(false);
                            buttonNine.setEnabled(true);
                            buttonNine.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelNine.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelNine.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdNine);
            }
        });
    }

    /**
     * 第10排确认按钮监听
     */
    public void onClickListenerTen() {
        buttonTen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdTen)) {
                    PRDownloader.pause(downloadIdTen);
                    return;
                }

                buttonTen.setEnabled(false);
                buttonTen.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarTen.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdTen)) {
                    PRDownloader.resume(downloadIdTen);
                    return;
                }
                downloadIdTen = PRDownloader.download(mUrl10, dirPath, "barcodescanner.apk")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarTen.setIndeterminate(false);
                            buttonTen.setEnabled(true);
                            buttonTen.setText(ResourceTable.String_pause);
                            buttonCancelTen.setEnabled(true);
                            buttonCancelTen.setText(ResourceTable.String_cancel);
                            buttonTen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonTen.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdTen = 0;
                            buttonTen.setText(ResourceTable.String_start);
                            buttonCancelTen.setEnabled(false);
                            progressBarTen.setProgressValue(0);
                            textViewProgressTen.setText("");
                            progressBarTen.setIndeterminate(false);
                            buttonCancelTen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarTen.setProgressValue((int) progressPercent);
                            textViewProgressTen.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonTen.setEnabled(false);
                            buttonCancelTen.setEnabled(false);
                            buttonTen.setText(ResourceTable.String_completed);
                            buttonTen.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelTen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonTen.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "10")
                                .build().show();
                            textViewProgressTen.setText("");
                            progressBarTen.setProgressValue(0);
                            downloadIdTen = 0;
                            buttonCancelTen.setEnabled(false);
                            progressBarTen.setIndeterminate(false);
                            buttonTen.setEnabled(true);
                            buttonTen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelTen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdTen);
            }
        });
    }

    /**
     * 第11排确认按钮监听
     */
    public void onClickListenerEleven() {
        buttonEleven.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdEleven)) {
                    PRDownloader.pause(downloadIdEleven);
                    return;
                }

                buttonEleven.setEnabled(false);
                buttonEleven.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarEleven.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdEleven)) {
                    PRDownloader.resume(downloadIdEleven);
                    return;
                }
                downloadIdEleven = PRDownloader.download(mUrl11, dirPath, "BigBuckBunny.m4v")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarEleven.setIndeterminate(false);
                            buttonEleven.setEnabled(true);
                            buttonEleven.setText(ResourceTable.String_pause);
                            buttonCancelEleven.setEnabled(true);
                            buttonCancelEleven.setText(ResourceTable.String_cancel);
                            buttonEleven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelEleven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonEleven.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdEleven = 0;
                            buttonEleven.setText(ResourceTable.String_start);
                            buttonCancelEleven.setEnabled(false);
                            progressBarEleven.setProgressValue(0);
                            textViewProgressEleven.setText("");
                            progressBarEleven.setIndeterminate(false);
                            buttonCancelEleven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarEleven.setProgressValue((int) progressPercent);
                            textViewProgressEleven.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonEleven.setEnabled(false);
                            buttonCancelEleven.setEnabled(false);
                            buttonEleven.setText(ResourceTable.String_completed);
                            buttonEleven.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelEleven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonEleven.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "11")
                                .build().show();
                            textViewProgressEleven.setText("");
                            progressBarEleven.setProgressValue(0);
                            downloadIdEleven = 0;
                            buttonCancelEleven.setEnabled(false);
                            progressBarEleven.setIndeterminate(false);
                            buttonEleven.setEnabled(true);
                            buttonEleven.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelEleven.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelEleven.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdEleven);
            }
        });
    }

    /**
     * 第12排确认按钮监听
     */
    public void onClickListenerTwelve() {
        buttonTwelve.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdTwelve)) {
                    PRDownloader.pause(downloadIdTwelve);
                    return;
                }

                buttonTwelve.setEnabled(false);
                buttonTwelve.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarTwelve.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdTwelve)) {
                    PRDownloader.resume(downloadIdTwelve);
                    return;
                }
                downloadIdTwelve = PRDownloader.download(mUrl12, dirPath, "harry-porter.pdf")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarTwelve.setIndeterminate(false);
                            buttonTwelve.setEnabled(true);
                            buttonTwelve.setText(ResourceTable.String_pause);
                            buttonCancelTwelve.setEnabled(true);
                            buttonCancelTwelve.setText(ResourceTable.String_cancel);
                            buttonTwelve.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTwelve.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonTwelve.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdTwelve = 0;
                            buttonTwelve.setText(ResourceTable.String_start);
                            buttonCancelTwelve.setEnabled(false);
                            progressBarTwelve.setProgressValue(0);
                            textViewProgressTwelve.setText("");
                            progressBarTwelve.setIndeterminate(false);
                            buttonCancelTwelve.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarTwelve.setProgressValue((int) progressPercent);
                            textViewProgressTwelve.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonTwelve.setEnabled(false);
                            buttonCancelTwelve.setEnabled(false);
                            buttonTwelve.setText(ResourceTable.String_completed);
                            buttonTwelve.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelTwelve.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonTwelve.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "12")
                                .build().show();
                            textViewProgressTwelve.setText("");
                            progressBarTwelve.setProgressValue(0);
                            downloadIdTwelve = 0;
                            buttonCancelTwelve.setEnabled(false);
                            progressBarTwelve.setIndeterminate(false);
                            buttonTwelve.setEnabled(true);
                            buttonTwelve.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelTwelve.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelTwelve.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdTwelve);
            }
        });
    }

    /**
     * 第13排确认按钮监听
     */
    public void onClickListenerThirteen() {
        buttonThirteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdThirteen)) {
                    PRDownloader.pause(downloadIdThirteen);
                    return;
                }

                buttonThirteen.setEnabled(false);
                buttonThirteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarThirteen.setIndeterminate(true);
                if (Status.PAUSED == PRDownloader.getStatus(downloadIdThirteen)) {
                    PRDownloader.resume(downloadIdThirteen);
                    return;
                }
                downloadIdThirteen = PRDownloader.download(mUrl13, dirPath, "giphy.gif")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarThirteen.setIndeterminate(false);
                            buttonThirteen.setEnabled(true);
                            buttonThirteen.setText(ResourceTable.String_pause);
                            buttonCancelThirteen.setEnabled(true);
                            buttonCancelThirteen.setText(ResourceTable.String_cancel);
                            buttonThirteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelThirteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonThirteen.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdThirteen = 0;
                            buttonThirteen.setText(ResourceTable.String_start);
                            buttonCancelThirteen.setEnabled(false);
                            progressBarThirteen.setProgressValue(0);
                            textViewProgressThirteen.setText("");
                            progressBarThirteen.setIndeterminate(false);
                            buttonCancelThirteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarThirteen.setProgressValue((int) progressPercent);
                            textViewProgressThirteen.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonThirteen.setEnabled(false);
                            buttonCancelThirteen.setEnabled(false);
                            buttonThirteen.setText(ResourceTable.String_completed);
                            buttonThirteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelThirteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonThirteen.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "13")
                                .build().show();
                            textViewProgressThirteen.setText("");
                            progressBarThirteen.setProgressValue(0);
                            downloadIdThirteen = 0;
                            buttonCancelThirteen.setEnabled(false);
                            progressBarThirteen.setIndeterminate(false);
                            buttonThirteen.setEnabled(true);
                            buttonThirteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelThirteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelThirteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdThirteen);
            }
        });
    }

    /**
     * 第14排确认按钮监听
     */
    public void onClickListenerFourteen() {
        buttonFourteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdFourteen)) {
                    PRDownloader.pause(downloadIdFourteen);
                    return;
                }

                buttonFourteen.setEnabled(false);
                buttonFourteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarFourteen.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdFourteen)) {
                    PRDownloader.resume(downloadIdFourteen);
                    return;
                }
                downloadIdFourteen = PRDownloader.download(mUrl14, dirPath, "small.mp4")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarFourteen.setIndeterminate(false);
                            buttonFourteen.setEnabled(true);
                            buttonFourteen.setText(ResourceTable.String_pause);
                            buttonCancelFourteen.setEnabled(true);
                            buttonCancelFourteen.setText(ResourceTable.String_cancel);
                            buttonFourteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFourteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonFourteen.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdFourteen = 0;
                            buttonFourteen.setText(ResourceTable.String_start);
                            buttonCancelFourteen.setEnabled(false);
                            progressBarFourteen.setProgressValue(0);
                            textViewProgressFourteen.setText("");
                            progressBarFourteen.setIndeterminate(false);
                            buttonCancelFourteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarFourteen.setProgressValue((int) progressPercent);
                            textViewProgressFourteen.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonFourteen.setEnabled(false);
                            buttonCancelFourteen.setEnabled(false);
                            buttonFourteen.setText(ResourceTable.String_completed);
                            buttonFourteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelFourteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonFourteen.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "14")
                                .build().show();
                            textViewProgressFourteen.setText("");
                            progressBarFourteen.setProgressValue(0);
                            downloadIdFourteen = 0;
                            buttonCancelFourteen.setEnabled(false);
                            progressBarFourteen.setIndeterminate(false);
                            buttonFourteen.setEnabled(true);
                            buttonFourteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFourteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelFourteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdFourteen);
            }
        });
    }

    /**
     * 第15排确认按钮监听
     */
    public void onClickListenerFifteen() {
        buttonFifteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                if (Status.RUNNING == PRDownloader.getStatus(downloadIdFifteen)) {
                    PRDownloader.pause(downloadIdFifteen);
                    return;
                }

                buttonFifteen.setEnabled(false);
                buttonFifteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                progressBarFifteen.setIndeterminate(true);

                if (Status.PAUSED == PRDownloader.getStatus(downloadIdFifteen)) {
                    PRDownloader.resume(downloadIdFifteen);
                    return;
                }
                downloadIdFifteen = PRDownloader.download(mUrl15, dirPath, "big_buck_bunny_720p_10mb.mp4")
                    .build()
                    .setOnStartOrResumeListener(new OnStartOrResumeListener() {
                        @Override
                        public void onStartOrResume() {
                            progressBarFifteen.setIndeterminate(false);
                            buttonFifteen.setEnabled(true);
                            buttonFifteen.setText(ResourceTable.String_pause);
                            buttonCancelFifteen.setEnabled(true);
                            buttonCancelFifteen.setText(ResourceTable.String_cancel);
                            buttonFifteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFifteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                        }
                    })
                    .setOnPauseListener(new OnPauseListener() {
                        @Override
                        public void onPause() {
                            buttonFifteen.setText(ResourceTable.String_resume);
                        }
                    })
                    .setOnCancelListener(new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            downloadIdFifteen = 0;
                            buttonFifteen.setText(ResourceTable.String_start);
                            buttonCancelFifteen.setEnabled(false);
                            progressBarFifteen.setProgressValue(0);
                            textViewProgressFifteen.setText("");
                            progressBarFifteen.setIndeterminate(false);
                            buttonCancelFifteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    })
                    .setOnProgressListener(new OnProgressListener() {
                        @Override
                        public void onProgress(Progress progress) {
                            long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
                            if (progress.totalBytes == 0) {
                                return;
                            }
                            progressBarFifteen.setProgressValue((int) progressPercent);
                            textViewProgressFifteen.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes));
                        }
                    })
                    .start(new OnDownloadListener() {
                        @Override
                        public void onDownloadComplete() {
                            buttonFifteen.setEnabled(false);
                            buttonCancelFifteen.setEnabled(false);
                            buttonFifteen.setText(ResourceTable.String_completed);
                            buttonFifteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                            buttonCancelFifteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }

                        @Override
                        public void onError(com.prdownloader.Error error) {
                            buttonFifteen.setText(ResourceTable.String_start);
                            new ToastsUtils.Builder(getContext())
                                .setToastText(
                                    getString(ResourceTable.String_some_error_occurred) + mei + "15")
                                .build().show();
                            textViewProgressFifteen.setText("");
                            progressBarFifteen.setProgressValue(0);
                            downloadIdFifteen = 0;
                            buttonCancelFifteen.setEnabled(false);
                            progressBarFifteen.setIndeterminate(false);
                            buttonFifteen.setEnabled(true);
                            buttonFifteen.setTextColor(new Color(Color.getIntColor(darckdeep)));
                            buttonCancelFifteen.setTextColor(new Color(Color.getIntColor(darcklight)));
                        }
                    });
            }
        });

        buttonCancelFifteen.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component view) {
                PRDownloader.cancel(downloadIdFifteen);
            }
        });
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    @Override
    protected void onOrientationChanged(AbilityInfo.DisplayOrientation displayOrientation) {
        super.onOrientationChanged(displayOrientation);
        if (displayOrientation == LANDSCAPE) {
            HiLog.warn(HI_LOG_LABEL, "======MainAbilitySlice onOrientationChanged is running....1");
        }
    }
    public  String getRootDirPath(Context context) {
        return context.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath();
    }
}
